package org.zhucy.zk;

import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.ZkServer;

import java.util.List;
import java.util.Optional;


/**
 * @Auther: zhuchunyang
 * @Date: 2019/6/19 16:33
 * @Description:
 */
public class ZkDemo {

    private static final String ZK_SERVER = "127.0.0.1:2181";
    public static void main(String[] args) {
        ZkClient zkClient = new ZkClient(ZK_SERVER,3000);
        /*List<String> children = zkClient.getChildren("/");
        Optional.ofNullable(children).get().forEach(cd -> System.out.println(cd));*/

        zkClient.writeData("/zk_test","this is a test b");
        if(zkClient!=null){
            zkClient.close();
        }

    }
}
